package net.optix.ip.commands
{
	import com.adobe.cairngorm.business.Responder;
	import com.adobe.cairngorm.commands.Command;
	import com.adobe.cairngorm.control.CairngormEvent;
	
	import net.optix.ip.business.*;
	import net.optix.ip.events.GetCopyrightEvent;
	import net.optix.ip.model.ModelLocator;
	import net.optix.ip.vo.CopyrightVO;
	
	public class GetCopyrightCommand implements Command, Responder
	{
		// attributes ============================
		private var model : ModelLocator = ModelLocator.getInstance();


		// functions ============================
		public function execute( event:CairngormEvent ) : void
		{
			var myEvent:GetCopyrightEvent = GetCopyrightEvent( event );
			
			var delegate:CopyrightDelegate = new CopyrightDelegate();     
			delegate.getCopyright( this,myEvent.copyrightID ,myEvent.userID, myEvent.role);
			
		}
		
		//----------------------------------------------------------------------------
		public function onResult( event : * = null ) : void
		{
			try
			{
				var	copy:XML	=	event.result;
				model.currentCopyright	=	CopyrightVO.purseCopyRight(copy);
			}
			catch(error:Error)
			{
				
			}
		}
		
		//----------------------------------------------------------------------------
		public function onFault( event : * = null ) : void
		{
			
		}

	}
}